;
var lookupuser = {
    init: function () {
        this.eventBind()
    },
    eventBind: function () {
        $(".do-lookupuser").click(function () {
            var btnaction = $(this);
            if (btnaction.hasClass("disable")) {
                common_ops.alert("还没提交上去了，别瞎点")
                return
            }

            var name = $(".lookupuser input[name=lookupuser]").val();


            $.ajax({
                url: common_ops.buildUrl("/work/lookupuser"),
                type: "POST",
                data: {

                    name: name,
                },
                dataType: 'json',
                success: function (res) {
                    btnaction.removeClass("disabled");
                    var callback = null;
                    if (res.code == 200) {
                        callback = function () {
                            // window.location.href = common_ops.buildUrl("/work/index");
                            document.getElementById("name").value = res.data.name;
                            document.getElementById("dep").value = res.data.dep;
                            document.getElementById("company").value = res.data.company;
                            document.getElementById("uid").value = res.data.id;

                        };
                    }
                    common_ops.alert(res.msg, callback);
                }
            });

        });
    }
};
$(document).ready(function () {
    lookupuser.init();
});

var changeuser = {
    init: function () {
        this.eventBind()
    },
    eventBind: function () {
        $(".do-changeuser").click(function () {
            var btnaction = $(this);
            if (btnaction.hasClass("disable")) {
                common_ops.alert("还没提交上去了，别瞎点")
                return
            }

            var uid = $(".user_wrap input[name=uid]").val();
            var id = $(".itfix-title input[name=updataid]").val();


            $.ajax({
                url: common_ops.buildUrl("/work/changeuser"),
                type: "POST",
                data: {
                    id:id,
                    uid:uid,
                },
                dataType: 'json',
                success: function (res) {
                    btnaction.removeClass("disabled");
                    var callback = null;
                    if (res.code == 200) {
                        callback = function () {
                            window.location.href = common_ops.buildUrl("/work/index");
                        };
                    }
                    common_ops.alert(res.msg, callback);
                }
            });

        });
    }
};
$(document).ready(function () {
    changeuser.init();
});